﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IdmlSharp
{
	public class Idml
	{

		private Document _document;

		public Document Document
		{
			get { return _document; }
			set { _document = value; }
		}

	}

	public class Document
	{

		#region Spreads

		private IDictionary<string, Spread> _spreads;

		public IDictionary<string, Spread> Spreads
		{
			get { return _spreads; }
			set { _spreads = value; }
		}

		public void AddSpread(string key, Spread spread)
		{
			if (this._spreads == null)
			{
				this._spreads = new Dictionary<string, Spread>();
			}
			this._spreads.Add(key, spread);
		}

		#endregion

		#region Stories

		private IDictionary<string, Story> _stories;

		public IDictionary<string, Story> Stories
		{
			get { return _stories; }
			set { _stories = value; }
		}

		public void AddStory(string key, Story story)
		{
			if (this._stories == null)
			{
				this._stories = new Dictionary<string, Story>();
			}
			this._stories.Add(key, story);
		}

		#endregion

	}

	#region Spread

	public class Spread
	{

		public Spread(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }
		}

		#region Page

		private Page _page;

		public Page Page
		{
			get { return _page; }
			set { _page = value; }
		}

		#endregion

		#region Rectangles

		private IDictionary<string, Rectangle> _rectangles;

		public IDictionary<string, Rectangle> Rectangles
		{
			get { return _rectangles; }
		}

		public void AddRectangle(string key, Rectangle rectangles)
		{
			if (this._rectangles == null)
			{
				this._rectangles = new Dictionary<string, Rectangle>();
			}
			this._rectangles.Add(key, rectangles);
		}

		#endregion

		#region TextFrames

		private IDictionary<string, TextFrame> _textFrames;

		public IDictionary<string, TextFrame> TextFrames
		{
			get { return _textFrames; }
		}

		public void AddTextFrame(string key, TextFrame textFrame)
		{
			if (this._textFrames == null)
			{
				this._textFrames = new Dictionary<string, TextFrame>();
			}
			this._textFrames.Add(key, textFrame);
		}

		#endregion

	}

	public class Page
	{


	}

	public class Rectangle
	{
		public Rectangle(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }
		}

		#region Images

		private IDictionary<string, Image> _images;

		public IDictionary<string, Image> Images
		{
			get { return _images; }
		}

		public void AddImage(string key, Image image)
		{
			if (this._images == null)
			{
				this._images = new Dictionary<string, Image>();
			}
			this._images.Add(key, image);
		}

		#endregion
	}

	public class Image
	{
		public Image(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }		
		}

		#region Links

		private IDictionary<string, Link> _links;

		public IDictionary<string, Link> Links
		{
			get { return _links; }
		}

		public void AddLink(string key, Link link)
		{
			if (this._links == null)
			{
				this._links = new Dictionary<string, Link>();
			}
			this._links.Add(key, link);
		}

		#endregion
	}

	public class Link
	{
		public Link(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }		
		}

		#region LinkResourceURI

		private string _linkResourceURI;

		public string LinkResourceURI
		{
			get { return _linkResourceURI; }
			set { _linkResourceURI = value; }
		}

		#endregion
	}

	public class TextFrame
	{

		public TextFrame(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }		}



		#region ParentStory

		internal string _parentStoryId;

		private Story _parentStory;

		public Story ParentStory
		{
			get { return _parentStory; }
		}

		internal void SetParentStory(Story parentStory)
		{
			this._parentStory = parentStory;
		}

		#endregion

		#region Methods

		#endregion

	}

	#endregion

	public class Story
	{
		public Story(string self)
		{
			_self = self;
		}

		private string _self;

		public string Self
		{
			get { return _self; }
			set { _self = value; }
		}

		private ParagraphStyleRange _paragraphStyleRange;

		public ParagraphStyleRange ParagraphStyleRange
		{
			get { return _paragraphStyleRange; }
			set { _paragraphStyleRange = value; }
		}

	}


	public class ParagraphStyleRange
	{
		private CharacterStyleRange _characterStyleRange;

		public CharacterStyleRange CharacterStyleRange
		{
			get { return _characterStyleRange; }
			set { _characterStyleRange = value; }
		}
	}

	public class CharacterStyleRange
	{

		private string _content;

		public string Content
		{
			get { return _content; }
			set { _content = value; }
		}
	}

}
